home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 142
/
Volume 142 Oct 17 2011 - Damaged.iso
/
Games
/
operation-graduates.swf
/
scripts
/
frame_41
/
DoAction_4.as
< prev
next >
Wrap
Text File
|
2011-10-17
|
3KB
|
141 lines
function spawnTentacle(xSpot)
{
var _loc1_ = enemyContainer.attachMovie("tentacle","enemy" + eConCount++,eConCount);
_loc1_.gotoAndStop(1);
_loc1_._x = xSpot;
_loc1_._rotation = Math.atan2(theHull._y - _loc1_._y,theHull._x - _loc1_._x) * 57.29577951308232 - 90;
_loc1_.myDest = new Vector(theHull._x - _loc1_._x,theHull._y - _loc1_._y);
_loc1_.myDest.setLength(128);
_loc1_.t = 0;
_loc1_.d = 30;
_loc1_.sX = _loc1_._x;
_loc1_.cX = _loc1_.myDest.x;
_loc1_.sY = _loc1_._y;
_loc1_.cY = _loc1_.myDest.y;
_loc1_.move = tentacleMover;
_loc1_.shoot = tentacleShooter;
_loc1_.hit = tentacleHit;
_loc1_.isHit = false;
_loc1_.energy = 70;
_loc1_.countdown;
_loc1_.Q1logic = baddyQ1;
_loc1_.Q2logic = baddyQ2;
_loc1_.Q3logic = baddyQ3;
_loc1_.Q4logic = baddyQ4;
_loc1_.collide = baddyCollide;
}
function tentacleMover()
{
if(this.isHit)
{
this.resetColor();
this.isHit = false;
}
with(this)
{
if(t < d)
{
t++;
_x = Math.easeOutQuad(t,sX,cX,d);
_y = Math.easeOutQuad(t,sY,cY,d);
}
if(t == d)
{
myDest.reset(theHull._x - _x,theHull._y - _y);
myDest.setLength(128);
t = 0;
d = 5;
sX = _rotation;
cX = Math.atan2(theHull._y - _y,theHull._x - _x) * 57.29577951308232 - 90 - _rotation;
if(cX > 180)
{
cX = 360 - cX;
}
else if(cX < -180)
{
cX = 360 + cX;
}
move = tentacleRotator;
}
}
}
function tentacleRotator()
{
if(this.isHit)
{
this.resetColor();
this.isHit = false;
}
with(this)
{
if(t < d)
{
t++;
_rotation = Math.easeOutQuad(t,sX,cX,d);
}
if(t == d)
{
gotoAndPlay("shoot");
t = 0;
d = 30;
sX = _x;
cX = myDest.x;
sY = _y;
cY = myDest.y;
this.countdown = 30;
move = tentacleCountdown;
}
}
}
function tentacleShooter()
{
var _loc1_ = this;
var _loc3_ = eBullets.attachMovie("eBul1","bullet" + eBulletsCount++,eBulletsCount);
var _loc2_ = new Object();
_loc2_.x = _loc1_.shootspot._x;
_loc2_.y = _loc1_.shootspot._y;
_loc1_.localToGlobal(_loc2_);
_loc3_._x = _loc2_.x;
_loc3_._y = _loc2_.y;
_loc3_.vel = _loc1_.myDest.getClone();
_loc3_.vel.setLength(5);
_loc3_.onEnterFrame = function()
{
var _loc1_ = this;
_loc1_._x += _loc1_.vel.x;
_loc1_._y += _loc1_.vel.y;
if(_loc1_._x < 0 || _loc1_._x > 600 || _loc1_._y < 0 || _loc1_._y > 400)
{
_loc1_.removeMovieClip();
}
};
}
function tentacleHit()
{
var _loc1_ = this;
_loc1_.setRGB(16777215);
_loc1_.isHit = true;
_loc1_.energy -= 5;
if(_loc1_.energy <= 0)
{
playSound("sound.missile.explode");
explode(_loc1_);
addScore(500);
baddyKillCount++;
}
}
function tentacleCountdown()
{
var _loc1_ = this;
if(_loc1_.isHit)
{
_loc1_.resetColor();
_loc1_.isHit = false;
}
_loc1_.countdown = _loc1_.countdown - 1;
if(_loc1_.countdown == 0)
{
_loc1_.move = tentacleMover;
}
}